package com.menhai.personmanagement.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.menhai.personmanagement.entity.TjWordsTemplate;
import com.menhai.personmanagement.services.ITjWordsTemplateService;

import lombok.extern.slf4j.Slf4j;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author shikun
 * @since 2022-01-12
 */

@Slf4j
@RestController
@RequestMapping("/tj-words-template")
public class TjWordsTemplateController {

     @Autowired
     private ITjWordsTemplateService tjWordsTemplateService;


     @RequestMapping("/findWordsById")
     public List findWordsById(@Param("id") String id){
          return tjWordsTemplateService.findWordsById(id);
     }
     
     /**
      * 获取模板列表
      * @param TjWordsTemplate
      * @return
      */
     @RequestMapping("/selectByList")
 	 public IPage<TjWordsTemplate> getTemplateList(TjWordsTemplate TjWordsTemplate){
 		return tjWordsTemplateService.getTemplateList(TjWordsTemplate);
 	 }
     
     /**
      * 新建模板
      * @param TjWordsTemplate
      * @return
      */
     @RequestMapping("/addTemplate")
 	 public Object addTemplate(TjWordsTemplate TjWordsTemplate){
 		return tjWordsTemplateService.addTemplate(TjWordsTemplate);
 	 }
     
     /**
      * 删除模板
      * @param request
      * @param response
      * @return
      */
     @RequestMapping("/deleteTemplate")
 	 public Object deleteTemplate(HttpServletRequest request,HttpServletResponse response){
    	String templateId = request.getParameter("templateId");
 		return tjWordsTemplateService.deleteTemplate(templateId);
 	 }
     
     /**
      * 编辑模板
      * @param TjWordsTemplate
      * @return
      */
     @RequestMapping("/updateTemplate")
 	 public Object updateTemplate(TjWordsTemplate TjWordsTemplate){
 		return tjWordsTemplateService.updateTemplate(TjWordsTemplate);
 	 }
}
